import 'package:camera/camera.dart';

/// 全局相机列表（需要在 main() 先初始化）
List<CameraDescription> globalCameras = [];

/// 相机状态模型
class DemoCameraState {
  final bool initialized;
  final bool torchOn;
  final XFile? pickedImage;
  final CameraController? controller;

  const DemoCameraState({
    this.initialized = false,
    this.torchOn = false,
    this.pickedImage,
    this.controller,
  });

  DemoCameraState copyWith({
    bool? initialized,
    bool? torchOn,
    XFile? pickedImage,
    CameraController? controller,
  }) {
    return DemoCameraState(
      initialized: initialized ?? this.initialized,
      torchOn: torchOn ?? this.torchOn,
      pickedImage: pickedImage ?? this.pickedImage,
      controller: controller ?? this.controller,
    );
  }
}
